// CurShowStatic.cpp : implementation file
//

#include "stdafx.h"
#include "main.h"
#include "CurShowStatic.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCurShowStatic

CCurShowStatic::CCurShowStatic()
{
}

CCurShowStatic::~CCurShowStatic()
{
}


BEGIN_MESSAGE_MAP(CCurShowStatic, CStatic)
	//{{AFX_MSG_MAP(CCurShowStatic)
	ON_WM_PAINT()
	ON_WM_LBUTTONDOWN()
	ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCurShowStatic message handlers

void CCurShowStatic::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
//	CStatic::OnPaint();
	dc.SetBkMode(TRANSPARENT); 
	// TODO: Add your message handler code here
	CRect rcBounds;
	GetClientRect(&rcBounds);
 
	CPen penBorder;
	CPen* pOldPen =dc.GetCurrentPen(); // dc.SelectObject(&penBorder);

	penBorder.CreatePen(PS_SOLID, CURSHOWBORDERLEN, RGB(255,0,0));
	dc.SelectObject(penBorder);
	dc.MoveTo(rcBounds.left + (CURSHOWBORDERLEN-1)/2, rcBounds.top + (CURSHOWBORDERLEN-1)/2);
	dc.LineTo(rcBounds.right-(CURSHOWBORDERLEN-1),rcBounds.top + (CURSHOWBORDERLEN-1)/2);
	dc.LineTo(rcBounds.right-(CURSHOWBORDERLEN-1),rcBounds.bottom-(CURSHOWBORDERLEN-1));
	dc.LineTo(rcBounds.left + (CURSHOWBORDERLEN-1)/2, rcBounds.bottom-(CURSHOWBORDERLEN-1));
	dc.LineTo(rcBounds.left + (CURSHOWBORDERLEN-1)/2, rcBounds.top + (CURSHOWBORDERLEN-1)/2);
	dc.SelectObject(pOldPen);
	penBorder.DeleteObject();
	pOldPen->DeleteObject();

	// Do not call CStatic::OnPaint() for painting messages
}


// HBRUSH CCurShowStatic::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
// {
// 	HBRUSH hbr = CStatic::OnCtlColor(pDC, pWnd, nCtlColor);
// 	
// 	// TODO: Change any attributes of the DC here
// // 	if(nCtlColor == CTLCOLOR_STATIC)   
// // 	{
// // 		pDC->SetBkMode(TRANSPARENT);   
// // 		hbr=(HBRUSH)::GetStockObject(NULL_BRUSH);   
// //     
// // 	}  	
// 	// TODO: Return a different brush if the default is not desired
// 	return hbr;
// }

void CCurShowStatic::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CStatic::OnLButtonDown(nFlags, point);
}

BOOL CCurShowStatic::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	return TRUE;
//	return CStatic::OnEraseBkgnd(pDC);
}
